Denizen Script Tags


Tags are always written with a <between these marks>, and are critical to scripts, as the primary way to read data.
Learn about how tags work in The Beginner's Guide.


Showing 1 out of 2437 tags...
Name<ListTag.sort[<procedure>]>
ReturnsListTag
DescriptionReturns a list sorted according to the return values of a procedure.
The <procedure> should link a procedure script that takes two definitions each of which will be an item
in the list, and returns -1, 0, or 1 based on whether the second item should be added. EG, if a procedure
with definitions "one" and "two" returned -1, it would place "two" after "one". Note that this
uses some complex internal sorting code that could potentially throw errors if the procedure does not return
consistently - EG, if "one" and "two" returned 1, but "two" and "one" returned 1 as well - obviously,
"two" can not be both before AND after "one"!
Note that the script should ALWAYS return -1, 0, or 1, or glitches could happen!
Note that if two inputs are exactly equal, the procedure should always return 0.
Sourcehttps://github.com/DenizenScript/Denizen-Core/blob/master/src/main/java/com/denizenscript/denizencore/objects/core/ListTag.java#L2250